package com.one.blocks.rbac.datascope;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author <a href="mailto:idler41@163.com">linfuxin</a> created by 2022-12-03 10:10:52
 */
@Inherited
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface DataScope {

    public String currentNodeSql() default "org_id in (select org_id from sys_user_org where user_id = ? )";

    public String nodeAndChildSql() default "org_id in (select so002.id from sys_org so002 inner join (select full_code from sys_org so001 inner join sys_user_org suo on so001.id = suo.org_id and user_id = ?) tmp001 on so002.full_code like concat(tmp001.full_code, '%'))";

    public String customSql() default "org_id in (select org_id from sys_role_org where role_id in (?) )";

    public String selfSql() default "create_id = ?";
}
